package com.jjlin.chapter_8;

import java.util.*;
public class CD1{

    public static boolean isContains(int[][] nums, int k){
        int rows = nums.length - 1;
        int cols = nums[0].length - 1;
        int i = 0, j = cols;
        while(i <= rows && j >= 0){
            if(nums[i][j] < k)//排除一行
                i++;
            else if(nums[i][j] > k)//排除一列
                j--;
            else
                return true;
        }
        return false;
    }


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        int[][] nums = new int[n][m];
        for(int i = 0; i < n; i++)
            for(int j = 0; j < m; j++)
                nums[i][j] = sc.nextInt();
        System.out.println(isContains(nums, k) ? "Yes" : "No");
    }
}
